package com.iexbuy.ihg.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.iexbuy.ihg.App;
import com.iexbuy.ihg.R;
import com.iexbuy.ihg.entity.ReComment;
import com.iexbuy.ihg.net.ServiceHelper;
import com.iexbuy.ihg.utils.StringUtil;
import com.iexbuy.ihg.utils.ToastUtils;
import com.jingchen.pulltorefresh.PullToRefreshLayout;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.view.annotation.ViewInject;

import java.util.HashMap;

public class WeDeRecommentDetailFragment extends BaseFragment {

	private static WeDeRecommentDetailFragment homeFragmentInstent;

	@ViewInject(R.id.msgListLayout)
	private PullToRefreshLayout msgListRefreshLayout;
	@ViewInject(R.id.recommentType)
	private TextView recommentType;
	@ViewInject(R.id.commentText)
	private TextView commentText;
	@ViewInject(R.id.recommentStatus)
	private TextView recommentStatus;
	@ViewInject(R.id.recommentTime)
	private TextView recommentTime;
	@ViewInject(R.id.feedback)
	private TextView feedback;

	private static ReComment reComment;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		homeFragmentInstent = this;
	}

	@Override
	protected View _onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_wede_recomment_detail, container, false);
		ViewUtils.inject(this, rootView);
		initView(rootView);
		return rootView;
	}

	private void initView(View rootView) {
		mBaseActivity.setTitle(getResources().getString(R.string.we_de_response_comment_detail));
		mBaseActivity.setTitleLayoutVisibility(true);
		mBaseActivity.setHomeActivity(false);

		initRecommentView();
	}

	private void initRecommentView() {
		if (reComment == null) {
			return;
		}
		recommentType.setText(reComment.getTypeName());
		commentText.setText(reComment.getContents());
		recommentStatus.setText(reComment.getStatusName());
		recommentTime.setText(reComment.getCtime());
		feedback.setText(StringUtil.isEmpty(reComment.getProcess())?"等待处理":reComment.getProcess());
	}


	public static void setReComment(ReComment reComment) {
		WeDeRecommentDetailFragment.reComment = reComment;
	}

	/**
	 * @return the homeFragmentInstent
	 */
	public static WeDeRecommentDetailFragment getHomeFragmentInstent() {
		return homeFragmentInstent;
	}

}
